<?
session_start();
include("config.php");
if ($_SESSION['admin']!="OK")
{
	echo "<script language='javascript'>alert('Please log in!');window.location.href='login.php';</script>";
	exit;
}
?>
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title>Questionnaire Survey System Management</title> 
<link href="main.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function checkdel()
{
	if(!confirm('Confirm to Delete?')) 
		return false;
}
</script>
</head> 
<body>
<div id=main>
	<div class=title>Vote Topic Management</div>
	<div id="menu">
	<ul>
		<li><a href='admin.php'>Administraction</a></li>
		<li><a href="editadmin.php">Your Account</a></li>
		<li><a href="addtitle.php" class="top">Add vote topic</a></li>
		<li><a href="showvote.php" target="_blank">Vote result</a></li>
		<li><a href="javascript:$msg=confirm('Are u sure to clean the result?');$msg?window.location.href='clearResult.php':history.go(0);">Delete Result</a></li>
		<li><a href="loginout.php">Log out</a></li>
		<li><a href="index.php" target="_blank">Home</a></li>
	</ul>
	</div>
	<?
	$conn=mysql_connect($host,$user,$password);
	mysql_select_db($db);
	mysql_query("SET NAMES UTF8");
	$sql="select * from vote_title order by id desc";
	$result=mysql_query($sql);
	if (mysql_num_rows($result)==0)
	{
		echo "<br><br><center><font color=red>No existed Topic!</font></center>";
	}
	else
	{
		while($row = mysql_fetch_array($result))
		{
	?>
			<div class="mamage">
				<div class=bt>Topic</div>
				<div class=btnr><? echo strlen(stripslashes($row["title"]))>80?chinesesubstr(stripslashes($row["title"]),0,80)."...":stripslashes($row["title"])?></div>
				<div class=tjxx><a href="addchoice.php?id=<?=$row["id"];?>">Add options</a></div>
				<div class=del><a href="del.php?id=<?=$row["id"];?>" onClick="return checkdel()">Delete</a></div>
				<div class=yl><a href="edittitle.php?id=<?=$row["id"];?>" class="red">Edit</a></div>
				<!--  <LI class=dy><input name="textfield" type="text" class="inputs" title="Vote topic README" value="&lt;iframe frameborder=0 scrolling=auto src=&quot;vote.php?id=<?=$row["id"];?>&quot;&gt;&lt;/iframe&gt;" maxlength="200">
				</LI>
				-->
			</div>
	<?php
		}
	}
	?>
</div>
<br />
<center>Copyright@FengYL</center>
</body>
</html>
